package vo;

import entities.User;

/**
 *
 * @author sbaldrich
 */
public class VOUser implements Comparable<VOUser>
{

    private Integer idUser;
    private String handle;
    private String password;
    private String firstName;
    private String lastName;
    private String email;
    private String institution;
    private String country;
    private boolean isAdmin;
    private String team;
    private Integer rating;
    private Integer accepted;
    private Integer submissions;

    public VOUser() {
    }

    
    
    public VOUser(User u)
    {
        this.setIdUser(u.getIdUser());
        this.setCountry(u.getCountry());
        this.setInstitution(u.getInstitution());
        this.setEmail(u.getEmail());
        this.setFirstName(u.getFirstName());
        this.setLastName(u.getLastName());
        this.setPassword(u.getPassword());
        this.setRating(u.getRating());
        this.setTeam(u.getTeam());
        this.setIsAdmin(u.getIsAdmin());
        this.setAccepted(u.getAccepted());
        this.setSubmissions(u.getSubmissions());
        this.setHandle(u.getHandle());
    }

    public Integer getAccepted()
    {
        return accepted;
    }

    public void setAccepted(Integer accepted)
    {
        this.accepted = accepted;
    }

    public Integer getSubmissions()
    {
        return submissions;
    }

    public void setSubmissions(Integer submissions)
    {
        this.submissions = submissions;
    }


    public String getCountry()
    {
        return country;
    }

    public void setCountry(String country)
    {
        this.country = country;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getFirstName()
    {
        return firstName;
    }

    public void setFirstName(String firstName)
    {
        this.firstName = firstName;
    }

    public String getHandle()
    {
        return handle;
    }

    public void setHandle(String handle)
    {
        this.handle = handle;
    }

    public Integer getIdUser()
    {
        return idUser;
    }

    public void setIdUser(Integer idUser)
    {
        this.idUser = idUser;
    }

    public String getInstitution()
    {
        return institution;
    }

    public void setInstitution(String institution)
    {
        this.institution = institution;
    }

    public boolean isIsAdmin()
    {
        return isAdmin;
    }

    public void setIsAdmin(boolean isAdmin)
    {
        this.isAdmin = isAdmin;
    }

    public String getLastName()
    {
        return lastName;
    }

    public void setLastName(String lastName)
    {
        this.lastName = lastName;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public Integer getRating()
    {
        return rating;
    }

    public void setRating(Integer rating)
    {
        this.rating = rating;
    }

    public String getTeam()
    {
        return team;
    }

    public void setTeam(String team)
    {
        this.team = team;
    }

   @Override
   public String toString()
   {
       return this.getIdUser() + " -> " + this.getHandle();
   }

   @Override
   public int compareTo(VOUser other)
   {
       if(other.getRating() - this.getRating() == 0)
           return (this.getHandle().compareTo(other.getHandle()));
       return (other.getRating() - this.getRating());
   }
}
